Skip to content

fix: use date safely within validation window in organization spec#5535

Merged
dorner merged 1 commit intorubyforgood:mainfrom
costajohnt:fix/organization-spec-date
Apr 12, 2026
Merged

fix: use date safely within validation window in organization spec#5535
dorner merged 1 commit intorubyforgood:mainfrom
costajohnt:fix/organization-spec-date

Conversation

@costajohnt
Copy link
Copy Markdown
Contributor

@costajohnt costajohnt commented Apr 1, 2026

Summary

The test at organization_spec.rb:407 uses DateTime.current.next_year - 1.day for the issued_at field, which sits right at the boundary of the issued_at_cannot_be_further_than_1_year validation. This causes the rspec (2, 0) CI check to fail.

Changed to 6.months.from_now which keeps the same test intent (a future date that passes validation) while staying well within the allowed window.

Test plan

  • rspec spec/models/organization_spec.rb:405 passes
  • Full rspec (2, 0) CI shard passes

The test used `DateTime.current.next_year - 1.day` which is right at the
boundary of the `issued_at_cannot_be_further_than_1_year` validation.
This causes intermittent failures due to timing precision. Using
`6.months.from_now` keeps the test intent (future date that passes
validation) while staying well within the allowed window.
@dorner dorner merged commit 604088d into rubyforgood:main Apr 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants